
import { _decorator, Component, Node, Button } from 'cc';
import { Constants } from '../data/Constants';
import { CustomEventListener } from '../data/CustomEventListener';
import { BattleManager } from '../managers/BattleManager';
import { UIManager } from './UIManager';
const { ccclass, property } = _decorator;

@ccclass('WinPanel')
export class FailPanel extends Component {
    @property({
        type: Button,
        displayOrder: 1,
    })
    reloadBtn: Button = null!;

    start() {
        this.reloadBtn.node.on(Node.EventType.TOUCH_START, this._newLevelBtnClick, this)
    }

    private _newLevelBtnClick = () => {
        //回到主界面
        UIManager.hideDialog(Constants.UIPage.winPanel)
        UIManager.showDialog(Constants.UIPage.mainPanel)
        CustomEventListener.dispatchEvent(Constants.EventName.NEW_LEVEL)
    }
}
